package com.zjl.学习.第08章_配置文件.A_简单配置;


import com.zjl.springbatch.util.OutColour;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;

import java.nio.charset.Charset;

@SpringBootApplication
@ImportResource(value = {"classpath:batch/bacth_08A0.xml"})
@EnableBatchProcessing//开启spring batch
public class MyATasklet implements Tasklet {

    public static void main(String[] args) {
        System.setProperty("spring.profiles.active","xml");
        SpringApplication.run(MyATasklet.class, args);
        System.out.println("***********启动完毕**当前编码:" + Charset.defaultCharset().name() + "****************");

    }
    @Override
    public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {
        OutColour.out.printlnGreen("MyATasklet 执行完毕");
        return RepeatStatus.FINISHED;//已完成
    }
}
